'use strict';

const Controller = require('egg').Controller;
class HomeController extends Controller {
  async add() {
    // console.log('增加--contriller')
    const data = await this.ctx.service.home.add(this.ctx.request.body)
    this.ctx.body = data;
  }
  async page() {
    const data = await this.ctx.service.home.page(this.ctx.query)
    this.ctx.body = data;
  }
  async update() {
    const data = await this.ctx.service.home.update(this.ctx.request.body)
    this.ctx.body = data;
  }
  async delete() {
    console.log(this.ctx.query, 'query-----------')
    const data = await this.ctx.service.home.delete(this.ctx.query)
    this.ctx.body = data;
  }
  async search() {
    const data = await this.ctx.service.home.search(this.ctx.query.keywords)
    this.ctx.body = data
  }
  async findAll() {
    const data = await this.ctx.service.home.findAll()
    this.ctx.body = data
  }
  async findId() {
    const data = await this.ctx.service.home.findId(this.ctx.query.id)
    this.ctx.body = data
  }
}

module.exports = HomeController;
